package org.elasticsearch;

import java.util.Objects;


/**
 * ObS basic session credentials
 */
final class ObsBasicSessionCredentials extends ObsBasicCredentials {

    private final String securityToken;

    ObsBasicSessionCredentials(String accessKey, String secretKey, String securityToken) {
        super(accessKey, secretKey);
        this.securityToken = securityToken;
    }

    public String getSecurityToken() {
        return securityToken;
    }

    @Override
    public boolean equals(final Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        final ObsBasicSessionCredentials that = (ObsBasicSessionCredentials) o;
        return securityToken.equals(that.securityToken)
                && getAccessKeyId().equals(that.getAccessKeyId())
                && getSecretKey().equals(that.getSecretKey());
    }

    @Override
    public int hashCode() {
        return Objects.hash(securityToken, getAccessKeyId(), getSecretKey());
    }
}
